package com.example.demoex;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;


public class Welcome extends Activity implements Runnable {
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.welcome);
//		new Thread(this).start();
		ImageView view = (ImageView) this.findViewById(R.id.wel);
		
		AlphaAnimation anim = new AlphaAnimation(0.2f, 1.0f);
		anim.setDuration(1000);
		anim.setAnimationListener(new AnimationListener() {

			@Override
			public void onAnimationStart(Animation arg0) {

			}

			@Override
			public void onAnimationRepeat(Animation arg0) {

			}

			@Override
			public void onAnimationEnd(Animation arg0) {
				startActivity(new Intent(Welcome.this, Welcome_Guide.class));
				overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
				finish();
			}
		});
//		bg.setAnimation(anim);
		view.setAnimation(anim);
		anim.start();
	}

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		super.finish();
		
	}

	public void run() {
		try {

			Thread.sleep(2000);

//			if (mApplication.mRenRen.isAccessTokenExist()) {
//				startActivity(new Intent(Welcome.this, DemoExMainActivity.class));
//			} else {
				startActivity(new Intent(Welcome.this, Welcome_Guide.class));
				overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
//			}
			finish();
		} catch (InterruptedException e) {

		}
	}
}
